import i18n from '@/i18n'
import { Body, Controller, Post } from '@nestjs/common'
import { ApiOperation, ApiTags } from '@nestjs/swagger'
import { MetaPlatformAuthDto } from '../system/meta-platform/dto/meta-platform-auth.dto'
import { MetaPlatformGetBindDataSourceTypeDto } from '../system/meta-platform/dto/meta-platform-get-bind-data-source-type.dto'
import { MetaPlatformGetBindDataSourceDto } from '../system/meta-platform/dto/meta-platform-get-bind-data-source.dto'
import { MetaPlatformGetChartDataDto } from '../system/meta-platform/dto/meta-platform-get-chart-data.dto'
import { MetaPlatformGetHistoryChartDataDto } from '../system/meta-platform/dto/meta-platform-get-history-chart-data.dto'
import { MetaPlatformGetRealtimeDataDto } from '../system/meta-platform/dto/meta-platform-get-realtime-data.dto'
import { MetaPlatformRequestResourceModuleActionDto } from '../system/meta-platform/dto/meta-platform-request-resource-module-action.dto'
import { MetaPlatformSendCommandDto } from '../system/meta-platform/dto/meta-platform-send-comman.dto'
import { MetaPlatformVerifyControlPasswordDto } from '../system/meta-platform/dto/meta-platform-verify-control-password.dto'
import { MetaPlatformWsAuthDto } from '../system/meta-platform/dto/meta-platform-ws-auth.dto'
import { MetaPlatformGetBindDataSourceTypeVo } from '../system/meta-platform/vo/meta-platform-get-bind-data-source-type.vo'
import { MetaPlatformGetBindDataSourceVo } from '../system/meta-platform/vo/meta-platform-get-bind-data-source.vo'
import { MetaPlatformGetChartDataVo } from '../system/meta-platform/vo/meta-platform-get-chart-data.vo'
import { MetaPlatformGetRealtimeDataVo } from '../system/meta-platform/vo/meta-platform-get-realtime-data.vo'
import { MetaPlatformRequestResourceModuleActionVo } from '../system/meta-platform/vo/meta-platform-request-resource-module-action.vo'
import { MetaPlatformApiService } from './meta-platform-api.service'

@ApiTags(i18n.t('app-meta.meta-platform-api.meta-platform-api.12150106-0'))
@Controller('platform-api')
export class MetaPlatformApiController {
  constructor(protected platformApiService: MetaPlatformApiService) {}

  @ApiOperation({ summary: i18n.t('app-meta.meta-platform-api.meta-platform-api.12150106-1') })
  @Post('request_resource_chart')
  requestResourceChart(@Body() param: MetaPlatformGetChartDataDto): Promise<MetaPlatformGetChartDataVo> {
    return this.platformApiService.requestResourceChart(param)
  }

  @ApiOperation({ summary: i18n.t('meta-platform-api.meta-platform-api.000980-0') })
  @Post('request_resource_history_chart')
  requestResourceHistoryChart(@Body() param: MetaPlatformGetHistoryChartDataDto): Promise<MetaPlatformGetChartDataVo> {
    return this.platformApiService.requestResourceHistoryChart(param)
  }

  @ApiOperation({ summary: i18n.t('app-meta.meta-platform-api.meta-platform-api.12150106-2') })
  @Post('request_resource_module_action')
  requestResourceModuleAction(
    @Body() param: MetaPlatformRequestResourceModuleActionDto
  ): MetaPlatformRequestResourceModuleActionVo {
    return this.platformApiService.requestResourceModuleAction(param)
  }

  @ApiOperation({ summary: i18n.t('app-meta.meta-platform-api.meta-platform-api.12150106-3') })
  @Post('request_get_realtime_data')
  requestGetRealtimeData(@Body() param: MetaPlatformGetRealtimeDataDto): Promise<MetaPlatformGetRealtimeDataVo> {
    return this.platformApiService.requestGetRealtimeData(param)
  }

  @ApiOperation({ summary: i18n.t('app-meta.meta-platform-api.meta-platform-api.12150106-4') })
  @Post('request_auth')
  requestAuth(@Body() param: MetaPlatformAuthDto): Promise<void> {
    return this.platformApiService.requestAuth(param)
  }

  @ApiOperation({ summary: i18n.t('app-meta.meta-platform-api.meta-platform-api.12150106-5') })
  @Post('request_ws_auth')
  requestWsAuth(@Body() param: MetaPlatformWsAuthDto): Promise<void> {
    return this.platformApiService.requestWsAuth(param)
  }

  @ApiOperation({ summary: i18n.t('app-meta.meta-platform-api.meta-platform-api.12150106-6') })
  @Post('send_command')
  sendCommand(@Body() param: MetaPlatformSendCommandDto): Promise<void> {
    return this.platformApiService.requestSendCommand(param)
  }

  @ApiOperation({ summary: i18n.t('app-meta.meta-platform-api.meta-platform-api.12150106-7') })
  @Post('verify_control_password')
  verifyControlPassword(@Body() param: MetaPlatformVerifyControlPasswordDto): Promise<void> {
    return this.platformApiService.requestVerifyControlPassword(param)
  }

  @ApiOperation({ summary: i18n.t('app-meta.meta-platform-api.meta-platform-api.12150106-8') })
  @Post('request_get_bind_data_source')
  requestGetBindDataSource(
    @Body() param: MetaPlatformGetBindDataSourceDto
  ): Promise<MetaPlatformGetBindDataSourceVo[]> {
    return this.platformApiService.requestGetBindDataSource(param)
  }

  @ApiOperation({ summary: i18n.t('app-meta.meta-platform-api.meta-platform-api.12150106-9') })
  @Post('request_get_bind_data_source_type')
  requestGetBindDataSourceType(
    @Body() param: MetaPlatformGetBindDataSourceTypeDto
  ): Promise<MetaPlatformGetBindDataSourceTypeVo> {
    return this.platformApiService.requestGetBindDataSourceType(param)
  }
}
